Tighten NameSchema to hyphen-only 2–64 and migrate legacy ./_ names - #536
Tighten NameSchema to hyphen-only 2–64 and migrate legacy ./_ names#536bhaveshpatel640 wants to merge 8 commits into
Conversation
🦋 Changeset detectedLatest commit: 9cab4dd The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
22b6e2a to
5229921
Compare
a62baaa to
8b89256
Compare
ccc20d0 to
c381c0a
Compare
91598c9 to
a0c3c76
Compare
b442af5 to
1081bee
Compare
8bd15a3 to
d1879c2
Compare
9927e2b to
a569517
Compare
ae2ac25 to
50d82db
Compare
b9f437a to
561a438
Compare
6f9428d to
a964381
Compare
8cd8b58 to
ab9ec81
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 83940f2. Configure here.
5e580ff to
975885d
Compare
77b41c1 to
63133da
Compare
|
Current version of PR was reviewed by /review-bugbot with additional instructions on Sep 11, 16:31 GMT+5:30. It flagged 1 finding. Show 1 finding1. Provider rename map without row update
In the model-provider loop, a provider rename is appended to Bugbot on commit |
|
Current version of PR was reviewed by /review-bugbot with additional instructions on Sep 11, 16:31 GMT+5:30. It flagged 1 finding. Show 1 finding1. Provider rename map without row update
In the model-provider loop, a provider rename is appended to Bugbot on commit |

Summary
Align TrueForge shared
NameSchema(ResourceName) with ServiceFoundry agent-identity / RemoteAgentV2: hyphen-only, 2–64 (^[a-z][a-z0-9-]{0,62}[a-z0-9]$).One schema for local resource names (agents, skills, MCP servers, models, schedules). Postgres + SQLite migration rewrites legacy local names that used
./_.Closes AGE-2065
Why
PUT /internal/tfg/agents/ agent-identity (source=trueforge).ResourceNameallowed./_; that breaks SVC sync and diverges from RemoteAgentV2.NameSchemaover a separateAgentNameSchemaso standalone create/list/update stay consistent after migrate.Changes
Schema
NameSchemainpackages/trueforge/src/schemas/common.tsto hyphen-only 2–64.ResourceName(CI regenerates OpenAPI + SDK; no hand-edits).NameSchema.API / validation impact
NameSchemareject names with.or_(e.g.my.agent,my_agent).tfg,trueforge) unchanged.TrueFoundry mode
NameSchema(must satisfy SVC identity).NameSchema-checked on those paths (FQNs / longer SVC MCP names OK).NameSchema.Standalone mode
NameSchema.Migration (
20260911_000001_name_hyphen_only)planHyphenOnlyRenames.tsapplyNameHyphenOnlyMigration.ts./_)./_→-, always append-<4 hex>; truncate to ≤ 64agent.name+ denormsession.agent_name/schedule.agent_nameskill.namemcp_server.name(+ manifest.name)model_provider.name(+ nestedmodels[].name, custom manifest.name)schedule.namedownthrows); originals not retained; no occupancy / collision check on suffixTests
nameSchema.test.ts— accept/reject matrixplanHyphenOnlyRenames.test.ts— rename + FQN skip + AgentSpec rewrite mapsagents.test.ts— API rejectsmy.agent/my_agenttrueFoundryNaming.test.ts— TFY runtime: agent name still NameSchema; skill FQN / long MCP / model FQN work on create/update, stores, mappers; OpenAPI MCP schemas may still be stricter than runtime (documented)Release
@truefoundry/trueforge@truefoundry/trueforge-sdkregenerate in CI after merge (do not hand-edit)Out of scope / known skew
TrueFoundryAgentManifest(3–32, no--) is not the TF ensure path; TF aligns to agent-identity (2–64).NameSchema; some OpenAPI MCP types still declareResourceName— runtime path does not re-parse those schemas today../_local names must switch to post-migration names.How was this tested?
nameSchema,planHyphenOnlyRenames,trueFoundryNaming, agents API reject casespnpm test(as needed before merge)pnpm smoke/ migrate against a DB that still has legacy./_names (recommended)Checklist
pnpm build,pnpm test,pnpm typecheck,pnpm lint:ci, andpnpm format:checkpass locallypackages/trueforge-sdk,.github/fern/openapi/openapi.json,docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge.env.exampleupdated if configuration or behavior changedNote
High Risk
Irreversible database migration mutates resource names and JSON manifests across multiple tables; API validation breaks clients still using dotted or underscored local names.
Overview
ResourceName validation is tightened so local names must be 2–64 chars, hyphen-only (no
.or_), matching ServiceFoundry agent identity. OpenAPIResourceNamepattern and ZodNameSchemaare updated together; create/update paths that use the schema now reject names likemy.agentandmy_agent.A one-time, irreversible Postgres and SQLite migration (
20260911_000001_name_hyphen_only) rewrites existing legacy local names:./_become hyphens plus a short random suffix, with follow-up updates to agent/session manifests, session/scheduleagent_name, and nested model provider model names. FQNs and already-valid hyphen names are left unchanged.AgentSpec model/skill/MCP references remain plain strings, so TrueFoundry FQNs and long SVC names in manifests are still allowed; new tests cover schema rules, migration planning, SQLite migration behavior, API rejection, and TFY naming edge cases.
Reviewed by Cursor Bugbot for commit 9cab4dd. Bugbot is set up for automated code reviews on this repo. Configure here.